package com.lqq.controller.restfull;

import com.lqq.dto.UserDetailDto;
import com.lqq.entity.User;
import com.lqq.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lqq
 * @date 2019/1/6
 */
@RestController
@Api(description = "关联查询")
public class AssociationController {

    @Autowired
    private UserService userService;


    @RequestMapping("/getUserDetailById")
    @ApiOperation(value = "根据id查询用户和地址信息，第1种查询方式",httpMethod = "GET")
    public User getUserDetailById(@RequestParam @ApiParam(required = true,defaultValue = "1") Long id){
        User user = userService.getUserDetailById(id);
        return user;
    }


    @RequestMapping("/getUserDetailById2")
    @ApiOperation(value = "根据id查询用户和地址信息，第2种查询方式",httpMethod = "GET")
    public UserDetailDto getUserDetailById2(@RequestParam @ApiParam(required = true,defaultValue = "1") Long id){
        UserDetailDto user = userService.getUserDetailById2(id);
        return user;
    }
}
